package com.xjscrm.server.common.util;

import com.uzai.mobile.collect.api.dto.MicaTransDto;
import com.uzai.mobile.collect.api.dto.MicaTriggerDto;
import com.xjscrm.server.vo.device.Device;

import java.util.function.Consumer;

/**
 * @author mingyang.chen create in 2024/3/1 18:25
 */
public class Functions {

    /**
     * 封装往服务器端发送消息
     * @author lucher
     * @date 2024/3/6 15:43
     * @param device
     * @return java.util.function.Consumer<com.uzai.mobile.collect.api.dto.MicaTransDto>
     */
    public static Consumer<MicaTransDto> fillTransMsg(Device device) {
        return item -> {
            item.setMerId(device.getMerId());
            item.setDeviceType(device.getDeviceType());
            item.setDeviceId(device.getDeviceId());
        };
    }

    /**
     * 封装往机器人端发送消息
     * @author lucher
     * @date 2024/3/6 15:43
     * @param device
     * @return java.util.function.Consumer<com.uzai.mobile.collect.api.dto.MicaTransDto>
     */
    public static Consumer<MicaTriggerDto> fillTriggerMsg(Device device) {
        return item -> {
            item.setMerId(device.getMerId());
            item.setDeviceType(device.getDeviceType());
            item.setDeviceId(device.getDeviceId());
        };
    }
}
